package com.rs.game.player.dialogues;

import com.rs.game.player.content.SlayerTask;
import com.rs.game.player.content.SlayerTask.*;
import com.rs.utils.Utils;

/**
 * Enchanted gem dialogue handling.
 * 
 * @author Jacob/Swirl <obruza@gmail.com>
 * 
 */

public class EnchantedGemDialouge extends Dialogue {

	@Override
	public void start() {

		Master master = player.getMaster();
		if (master.getId() == 9085) {
			sendNPCDialogue(master.getId(), 9827, "Hello there, " + Utils.formatPlayerNameForDisplay(player.getDisplayName()) + ", what can I help you with?");
		}
	}

	@Override
	public void run(int interfaceId, int componentId) {
		Master master = player.getMaster();
		if (master.getId() == 9085) {
			SlayerTask task = player.getTask();
			switch (stage) {
			case -1:
				sendOptionsDialogue("Select an Option", "How am I doing so far?", "Who are you?", "Where are you?", "Got any tips for me?", "Nothing really.");
				stage = 0;
				break;
			case 0:
				switch (componentId) {
				case OPTION_1:
					sendPlayerDialogue(9827, "How am I doing so far?");
					stage = 1;
					break;
				case OPTION_2:
					sendPlayerDialogue(9827, "Who are you?");
					stage = 3;
					break;
				case OPTION_3:
					sendPlayerDialogue(9827, "Where are you?");
					stage = 5;
					break;
				case OPTION_4:
					sendPlayerDialogue(9827, "Got any tips for me?");
					stage = 7;
					break;
				case OPTION_5:
					sendPlayerDialogue(9827, "Nothing really.");
					stage = 9;
					break;
				}
				break;
			case 1:
				if (player.getTask() != null) {
					sendNPCDialogue(9085, 9827, "You're currently assigned to kill " + task.getName().toLowerCase() + "; only " + task.getTaskAmount() + " more to go.");
				} else {
					sendNPCDialogue(9085, 9827, "You need something new to hunt. Come and see me when you can and I'll give you a new task.");
				}
				stage = 2;
				break;
			case 2:
				sendOptionsDialogue("Select an Option", "Who are you?", "Where are you?", "Got any tips for me?", "That's all, thanks.");
				stage = 10;
				break;
			case 3:
				sendNPCDialogue(9085, 9827, "My name's Kuradal; I'm a Slayer Master.");
				stage = 4;
				break;
			case 4:
				sendOptionsDialogue("Select an Option", "How am I doing so far?", "Where are you?", "Got any tips for me?", "That's all, thanks.");
				stage = 11;
				break;
			case 5:
				sendNPCDialogue(9085, 9827, "You'll find me in the ancient cavern, near the Dragonkin Forge. I'll be here when you need a new task.");
				stage = 6;
				break;
			case 6:
				sendOptionsDialogue("Select an Option", "How am I doing so far?", "Who are you?", "Got any tips for me?", "That's all, thanks.");
				stage = 12;
				break;
			case 7:
				sendNPCDialogue(9085, 9827, "Not at this time, sorry.");
				stage = 8;
				break;
			case 8:
				sendOptionsDialogue("Select an Option", "How am I doing so far?", "Who are you?", "Where are you?", "That's all, thanks.");
				stage = 13;
				break;
			case 9:
				end();
				break;
			case 10:
				switch (componentId) {
				case OPTION_1:
					sendPlayerDialogue(9827, "Who are you?");
					stage = 3;
					break;
				case OPTION_2:
					sendPlayerDialogue(9827, "Where are you?");
					stage = 5;
					break;
				case OPTION_3:
					sendPlayerDialogue(9827, "Got any tips for me?");
					stage = 7;
					break;
				case OPTION_4:
					sendPlayerDialogue(9827, "That's all, thanks.");
					stage = 9;
					break;
				}
				break;
			case 11:
				switch (componentId) {
				case OPTION_1:
					sendPlayerDialogue(9827, "How am I doing so far?");
					stage = 1;
					break;
				case OPTION_2:
					sendPlayerDialogue(9827, "Where are you?");
					stage = 5;
					break;
				case OPTION_3:
					sendPlayerDialogue(9827, "Got any tips for me?");
					stage = 7;
					break;
				case OPTION_4:
					sendPlayerDialogue(9827, "That's all, thanks.");
					stage = 9;
					break;
				}
				break;
			case 12:
				switch (componentId) {
				case OPTION_1:
					sendPlayerDialogue(9827, "How am I doing so far?");
					stage = 1;
					break;
				case OPTION_2:
					sendPlayerDialogue(9827, "Who are you?");
					stage = 3;
					break;
				case OPTION_3:
					sendPlayerDialogue(9827, "Got any tips for me?");
					stage = 7;
					break;
				case OPTION_4:
					sendPlayerDialogue(9827, "That's all, thanks.");
					stage = 9;
					break;
				}
				break;
			case 13:
				switch (componentId) {
				case OPTION_1:
					sendPlayerDialogue(9827, "How am I doing so far?");
					stage = 1;
					break;
				case OPTION_2:
					sendPlayerDialogue(9827, "Who are you?");
					stage = 3;
					break;
				case OPTION_3:
					sendPlayerDialogue(9827, "Where are you?");
					stage = 5;
					break;
				case OPTION_4:
					sendPlayerDialogue(9827, "That's all, thanks.");
					stage = 9;
					break;
				}
				break;
			}
		}

	}

	@Override
	public void finish() {

	}

}
